﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class LockTransform : MonoBehaviour
{
    public Transform @object;
    public Transform target;
    public MonoBehaviour[] mDisables;
    public Collider[] cDisables;
    public bool position = true;
    public bool rotation = true;
    public bool scale;



    // Update is called once per frame
    void Update()
    {
        foreach (var item in mDisables)
        {
            item.enabled = false;
        }
        foreach (var item in cDisables)
        {
            item.enabled = false;
        }
        if (position)
        {
            @object.position = target.position;
        }
        if (rotation)
        {
            @object.rotation = target.rotation;
        }
        if (scale)
        {
            @object.localScale = target.localScale;
        }
        foreach (var item in mDisables)
        {
            item.enabled = true;
        }
        foreach (var item in cDisables)
        {
            item.enabled = true;
        }
    }
}
